home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Fades ƒ / Corner circle fade.c < prev    next >
Text File  |  1994-04-15  |  2KB  |  75 lines

  1. /**********************************************************************\
  2.  
  3. File:        Corner circle fade.c
  4.  
  5. Purpose:    Graphic effect to fade main window to solid pattern.
  6.             See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define    gap            8        /* difference between one radius and the next */
  28. #define CorrectTime 2
  29.  
  30. pascal short CornerCircleFade(Rect boundsRect, Pattern *thePattern);
  31.  
  32. /* Make progressively larger circle regions, centered at the top-left corner
  33.    of the screen.  Quickdraw takes care of all the excess space off the screen
  34.    that you include in the region. */
  35.    
  36. pascal short CornerCircleFade(Rect boundsRect, Pattern *thePattern)
  37. {
  38.     Rect            theRect;
  39.     int                cx, cy;
  40.     RgnHandle        curregion, boundsRgn, sectrgn;
  41.     Point            zeropoint;
  42.     
  43.     zeropoint.v=boundsRect.bottom;
  44.     zeropoint.h=boundsRect.right;
  45.     
  46.     SetRect(&theRect, boundsRect.left-gap, boundsRect.top-gap, boundsRect.left+gap,
  47.         boundsRect.top+gap);
  48.     boundsRgn=NewRgn();
  49.     RectRgn(boundsRgn, &boundsRect);
  50.     sectrgn=NewRgn();
  51.     curregion=NewRgn();
  52.     do
  53.     {
  54.         StartTiming();
  55.         SetEmptyRgn(curregion);
  56.         OpenRgn();
  57.             FrameOval(&theRect);
  58.         CloseRgn(curregion);
  59.         SectRgn(curregion, boundsRgn, sectrgn);
  60.         FillRgn(sectrgn, *thePattern);
  61.         theRect.left-=gap;
  62.         theRect.right+=gap;
  63.         theRect.top-=gap;
  64.         theRect.bottom+=gap;
  65.         TimeCorrection(CorrectTime);
  66.     }
  67.     while (!(PtInRgn(zeropoint,curregion)));
  68.     
  69.     DisposeRgn(curregion);
  70.     DisposeRgn(boundsRgn);
  71.     DisposeRgn(sectrgn);
  72.     
  73.     return 0;
  74. }
  75.